package sgi.message;

/**query for modifying tariffs*/
public class MessageChangeTariff extends Message {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private String additionUpdateQuery;
	
	public boolean isRemovePendingQuery() {
		return this.additionUpdateQuery != null;
	}


	public String getAdditionUpdateQuery() {
		return additionUpdateQuery;
	}


	public MessageChangeTariff(float image,float timeLocation,float imagePack,float dataLayer) {
		super("INSERT INTO sgi.tariff (`id`, `image`, `time_location_subscription`, `image_pack_subscription`, `data_layer_subscription`, `pending`) " +
				"VALUES ('2','" + image + "', '" + timeLocation + "', '" + imagePack + "', '" + dataLayer + "', '2')");
		this.additionUpdateQuery= null;
	}
	
	
	public void updatePendings(){
		this.setQuery("DELETE FROM `sgi`.`tariff` WHERE `id`='1';");
		this.additionUpdateQuery = "UPDATE `sgi`.`tariff` SET `id`='1' WHERE `id`='2'";		
	}

}
